//loading开始-----------------------------------------------------------------------------------------------
function loading(json) {
	var index = 0;
	var imgs = [];
	for (var i = 0; i < json.arr.length; i++) {
		var imgobj = new Image();
		imgobj.src = json.arr[i];
		imgobj.onload = function() {
			index++;
			var per = parseInt((index / json.arr.length) * 100);
			if (json.span) {
				json.span.innerHTML = per + '%';
			}
			if (json.CloadW) {
				json.CloadW.style.width = per + '%';
			}

			imgs.push(this);
			if (index == json.arr.length) {
				json.succFn && json.succFn();
			}

		}
	}
}
var span = document.getElementById('lspan');
var arr = ['./imgs/4.png','./imgs/5.png','./imgs/6.png','./imgs/7.png','./imgs/8.png','./imgs/9.png','./imgs/10.png',
'./imgs/bg.jpg','./imgs/bg-h.jpg','./imgs/fxbg.jpg','./imgs/ar.png','./imgs/zj.png',
'./imgs/bg1.png','./imgs/bg2.png','./imgs/bg3.png','./imgs/bg4.png',
'./imgs/bg5.png','./imgs/bg6.png','./imgs/bg7.png','./imgs/bg8.png','./imgs/bg10.png'];

var arr2=['./imgs/1.png','./imgs/2.jpg','./imgs/3.png'];

loading({
	arr: arr2,
	succFn: function() {
		$('.loadgroup').css({opacity:1});
		setTimeout(function(){
			loading({
				arr: arr,
				span: span,
				succFn: function() {
					setTimeout(function(){
						$('.loadgroup').animate({'opacity':0},function(){$('.loadgroup').css({'display':'none'});});
						$('.group1').animate({opacity:1});	
					},2000)
					
				}
			})
		},1000)	
	}
})


//loading结束-----------------------------------------------------------------------------------------------





$(function() {
	var winW = $(window).width();
	var winH = $(window).height();
	
	
	
	
	
	//翻页初始化-------------------------------------------------------------------------------------------------
	$("#flipbook").turn({
		width: winW,
		height: winH,
		display: 'single',
	});
	
	$("#flipbook").bind("turning", function(event, page, pageObject) {
		// Implementation翻动前
		//		alert(page);
	});

	
	//翻页结束-------------------------------------------------------------------------------------------------
	
	
	
	
	
})